<div id="content">

	<h2>Albums photos</h2>
	<div id="albums">
		<form id="formAlbum" method="post" action="index.php?controller=gallery&action=addAlbum" enctype="multipart/form-data">
			<fieldset> <legend>Ajouter un album</legend>
				<table>
				<tr>
					<th><label for="name">Nom de l'album</label></th><td><input type="text" id="name" name="name"/></td>
					<th><label for="description">Description</label></th><td><textarea cols="30" row="3" id="description" name="description"></textarea></td>
				</tr>
				<tr>
					<th><label for="id_imageEnAvant">Image en avant: </label></th>
					<td>
						<select name="id_imageEnAvant" id="id_imageEnAvant">
							<option value=""></option>
							<?php 
							foreach ( $data->images as $key => $img ) {
								echo("<option value='".$img->getId()."'>".$img->getComment()."</option>");
       						}
       						?>
						</select>
					</td>
					<td><input type="submit" value = "Enregistrer"/></td>
				</tr>
				</table>
			</fieldset>
				
		</form>
			<div class="albumList">
			<?php foreach ( $data->albums as $key => $album) {	?>
				<div id="<?php echo $key ?>_album" class="album">
					<a href="index.php?controller=gallery&action=afficher&albumId=<?php echo $album->getId() ?>" >
						<?php echo $album->getName() ?>
					</a>
					<a href="index.php?controller=gallery&action=removeAlbum&albumId=<?php echo $album->getId() ?>" class="remove"><img src='<?php echo dirname($_SERVER['REQUEST_URI']); ?>/images/remove.png' alt='remove' title='remove'/></a><br/>
					<a href="index.php?controller=gallery&action=afficher&albumId=<?php echo $album->getId() ?>" >
					<?php
			       		echo("<img src='".$album->getImageEnAvantUrl($this)."' alt='".$album->getName()."' title='".$album->getName()."' class='miniature'/>");
			       		    $album->getImages($this);
		       		?>
		       		</a>
	       		</div>
	       	<?php } ?>
       		</div>
	</div>
		

</div>
